<?php

class TableNameBO{
	public $db;

	function __construct(){	
		if(!$this->db){
			$db = new db(HOST,USERNAME,PASSWORD);
			$db->set_db(DATABASE);
			$this->db = $db;
		}	
	}
	
	function  __destruct()
	{		
	}
	
	function getData($condition=1){
		$sql = "SELECT * FROM `tableName` WHERE ".$condition;
		return $this->db->query($sql);
	}
	
	function insert($fid,$en_US,$zh_CN,$de){
		$sql = "INSERT INTO `tableName` (`id`, `fid`, `en_US`, `zh_CN`, `de`)VALUES (NULL , '$fid' , '$en_US' , '$zh_CN' , '$de')";
		return $this->db->insertData($sql);		
	}
	
	function update($id,$fid,$en_US,$zh_CN,$de){
		$sql = "UPDATE `tableName` SET `fid`=\"$fid\", `en_US`='$en_US', `zh_CN`='$zh_CN', `de`='$de' WHERE `id`=$id";
		return $this->db->updateData($sql);
	}
	
	function delete($id){
		if(!is_array($id)){
			$sql = "DELETE FROM `tableName` WHERE `id`=$id";
		}else{
			$id = join(",", $id);
			$sql = "DELETE FROM `tableName` WHERE `id` in ($id)";			
		}
		return $this->db->updateData($sql);
	}
}

?>